<?php
    class DBH {
        private static $instance = null;
        private $dbh             = null;

        private function __construct() {
            $db_info = array(
                'host'     => 'localhost',
                'port'     => '3306',
                'database' => 'brafh',
                'user'     => 'root',
                'pass'     => '',
            );

            $dbh = null;

            try {
                $this->dbh = new PDO( 'mysql:host='.$db_info['host'].';dbname='.$db_info['database'], $db_info['user'], $db_info['pass'] );
            } catch( PDOException $e ) {
                die( 'No se puedo establecer una conexion a la base de datos: '.$e->getMessage() );
            }
        }

        static function GetInstance() {
            if( self::$instance == null ) {
                self::$instance = new DBH();
            }

            return self::$instance;
        }

        function get_dbh () { return $this->dbh; }
    }
?>